using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Windows.Forms;
using ICP_MS.Plugin.LA300.Properties;

namespace ICP_MS.Plugin.LA300;

public class FormSamples : Form
{
	private ExperimentDatas experiment = null;

	private ExperimentDB db = null;

	private ComboBox samplesBox = null;

	private NumericUpDown scanNums = null;

	private DataTable dtSampleType = new DataTable();

	private bool dragData = false;

	private int dragDest = -1;

	private IContainer components = null;

	private DbufferGrid dgvSamples;

	private ToolStrip toolStrip1;

	private ToolStripSeparator toolStripSeparator3;

	private DataGridViewTextBoxColumn dataGridViewTextBoxColumn1;

	private DataGridViewTextBoxColumn dataGridViewTextBoxColumn2;

	private DataGridViewTextBoxColumn dataGridViewTextBoxColumn3;

	private DataGridViewTextBoxColumn dataGridViewTextBoxColumn4;

	private DataGridViewTextBoxColumn dataGridViewTextBoxColumn5;

	private DataGridViewTextBoxColumn dataGridViewTextBoxColumn6;

	private DataGridViewTextBoxColumn dataGridViewTextBoxColumn7;

	private DataGridViewTextBoxColumn dataGridViewTextBoxColumn8;

	private ToolStripButton tsbtnDelete;

	private DataGridViewTextBoxColumn colSampleNumber;

	private DataGridViewCheckBoxColumn colSampleReport;

	private DataGridViewTextBoxColumn colSampleLabel;

	private DataGridViewComboBoxColumn colSampleType;

	private DataGridViewTextBoxColumn colSampleScan;

	private DataGridViewTextBoxColumn colSampleDilution;

	private DataGridViewTextBoxColumn colSampleInternal;

	private DataGridViewTextBoxColumn colSampleBlank;

	public event EventHandler UpdateSamples;

	public event EventHandler UpdateSampleName;

	public FormSamples()
	{
		InitializeComponent();
	}

	public void SetParams(ExperimentDatas experiment, ExperimentDB db)
	{
		this.experiment = experiment;
		this.db = db;
	}

	private void InitSamples()
	{
		((DataGridView)(object)dgvSamples).AutoGenerateColumns = false;
		colSampleScan.Visible = experiment.Scan.isPeakjump || experiment.Scan.isScan;
		((DataGridView)(object)dgvSamples).DataSource = experiment.Samples;
	}

	private void ProcessSampleLabel(string label, out string name, out int num)
	{
		IEnumerable<char> revLabel = label.Reverse();
		num = 0;
		int count = 0;
		foreach (char ch in revLabel)
		{
			if (char.IsDigit(ch))
			{
				count++;
				num = num * 10 + Convert.ToInt32(ch.ToString(), 10);
				continue;
			}
			break;
		}
		name = label.Substring(0, label.Length - count);
	}

	private void tsbtnAddSamples_Click(object sender, EventArgs e)
	{
		FormAddSampleNumber dlg = new FormAddSampleNumber(experiment.Samples);
		if (dlg.ShowDialog() != DialogResult.OK)
		{
			return;
		}
		int copy = dlg.SrcPosition;
		int pos = dlg.DestPosition;
		int numbers = dlg.Numbers;
		string lastName = "Sample ";
		int lastNum = 0;
		int lastcurveid = 1;
		if (experiment.Samples.Count > 0)
		{
			string label = experiment.Samples.Last().label;
			ProcessSampleLabel(label, out lastName, out lastNum);
			lastcurveid = experiment.Samples.Last().curveId;
		}
		IList<SamplesInfos> addSamples = new List<SamplesInfos>();
		for (int i = 0; i < numbers; i++)
		{
			SamplesInfos sample = new SamplesInfos();
			if (copy != -1)
			{
				int index = copy + i;
				if (index >= experiment.Samples.Count)
				{
					index = copy;
				}
				sample.label = experiment.Samples[index].label;
				sample.inter = experiment.Samples[index].inter;
				sample.predilution = experiment.Samples[index].predilution;
				sample.report = experiment.Samples[index].report;
				sample.mains = experiment.Samples[index].mains;
				sample.surveys = experiment.Samples[index].surveys;
				sample.type = experiment.Samples[index].type;
				sample.blank = experiment.Samples[index].blank;
				sample.curveId = experiment.Samples[index].curveId;
				sample.rackNumber = experiment.Samples[index].rackNumber;
				sample.vialNumber = experiment.Samples[index].vialNumber;
				sample.ZDepth = experiment.Samples[index].ZDepth;
			}
			else
			{
				sample.label = lastName + (lastNum + i + 1);
				sample.inter = "Default";
				sample.predilution = 1.0;
				sample.report = true;
				sample.mains = 3;
				sample.surveys = 1;
				sample.type = 3;
				sample.blank = -1;
				sample.curveId = lastcurveid;
				sample.rackNumber = -1;
				sample.vialNumber = -1;
				sample.ZDepth = "";
			}
			sample.guid = experiment.Scan.sampleIndex++;
			addSamples.Add(sample);
		}
		if (pos == -1)
		{
			experiment.Samples.AddRange(addSamples);
		}
		else
		{
			experiment.Samples.InsertRange(pos, addSamples);
		}
		RebindSamples();
		SamplesChangedNotify();
		experiment.CheckReferSample();
		experiment.Dirty.SamplesDirty = true;
		experiment.Dirty.ResultsDirty = true;
		experiment.Dirty.SpectrumDirty = true;
	}

	private void RebindSamples()
	{
		((DataGridView)(object)dgvSamples).AutoGenerateColumns = false;
		colSampleScan.Visible = experiment.Scan.isPeakjump || experiment.Scan.isScan;
		BindingContext[((DataGridView)(object)dgvSamples).DataSource].SuspendBinding();
		((DataGridView)(object)dgvSamples).DataSource = null;
		((DataGridView)(object)dgvSamples).DataSource = experiment.Samples;
		BindingContext[((DataGridView)(object)dgvSamples).DataSource].ResumeBinding();
	}

	private void dgvSamples_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
	{
		if (e.ColumnIndex < 0 || e.RowIndex < 0)
		{
			return;
		}
		switch (((DataGridView)(object)dgvSamples).Columns[e.ColumnIndex].DataPropertyName)
		{
		case "number":
		{
			experiment.Samples[e.RowIndex].number = e.RowIndex + 1;
			e.Value = e.RowIndex + 1;
			Color color = Color.Empty;
			switch (experiment.Samples[e.RowIndex].status)
			{
			case -1:
				color = Color.LightGreen;
				((DataGridView)(object)dgvSamples)[colSampleScan.Index, e.RowIndex].ReadOnly = true;
				break;
			case 0:
				color = Color.White;
				break;
			case 1:
				color = Color.LightBlue;
				((DataGridView)(object)dgvSamples)[colSampleScan.Index, e.RowIndex].ReadOnly = true;
				break;
			}
			((DataGridView)(object)dgvSamples).Rows[e.RowIndex].DefaultCellStyle.BackColor = color;
			break;
		}
		case "type":
			switch (experiment.Samples[e.RowIndex].type)
			{
			case 0:
				e.Value = Lang.Txt("FormExperiment.ConstNouns.SampleBlk.Text");
				e.CellStyle.BackColor = Color.Cyan;
				break;
			case 1:
				e.Value = Lang.Txt("FormExperiment.ConstNouns.SampleFQ.Text");
				e.CellStyle.BackColor = Color.Cyan;
				break;
			case 2:
				e.Value = Lang.Txt("FormExperiment.ConstNouns.SampleAddSA.Text");
				e.CellStyle.BackColor = Color.Chartreuse;
				break;
			case 3:
				e.Value = Lang.Txt("FormExperiment.ConstNouns.SampleUnk.Text");
				e.CellStyle.BackColor = Color.White;
				break;
			}
			break;
		case "blank":
		{
			int blank = experiment.Samples[e.RowIndex].blank;
			SamplesInfos blksample = experiment.Samples.Find((SamplesInfos s) => s.guid == blank);
			if (blksample != null)
			{
				e.Value = blksample.label;
			}
			else
			{
				e.Value = Lang.Txt("FormExperiment.ConstNouns.ForceNone.Text");
			}
			break;
		}
		}
	}

	private void dgvSamples_CellLeave(object sender, DataGridViewCellEventArgs e)
	{
		DisposeBoxes();
	}

	private void DisposeBoxes()
	{
		if (samplesBox != null)
		{
			samplesBox.Visible = false;
			samplesBox.Dispose();
			samplesBox = null;
		}
		if (scanNums != null)
		{
			scanNums.Visible = false;
			scanNums.Dispose();
			scanNums = null;
		}
	}

	private void dgvSamples_CurrentCellChanged(object sender, EventArgs e)
	{
		DbufferGrid dgv = (DbufferGrid)((sender is DbufferGrid) ? sender : null);
		if (((DataGridView)(object)dgv).CurrentCell == null)
		{
			return;
		}
		int rowIndex = ((DataGridView)(object)dgv).CurrentCell.RowIndex;
		int columnIndex = ((DataGridView)(object)dgv).CurrentCell.ColumnIndex;
		int num = columnIndex;
		int num2 = num;
		if (num2 != 7 || dgv.InCapture)
		{
			return;
		}
		samplesBox = new ComboBox();
		samplesBox.Parent = (Control)(object)dgv;
		samplesBox.DropDownStyle = ComboBoxStyle.DropDownList;
		Rectangle rect = ((DataGridView)(object)dgv).GetCellDisplayRectangle(columnIndex, rowIndex, cutOverflow: false);
		samplesBox.Left = rect.Left;
		samplesBox.Top = rect.Top;
		samplesBox.Width = rect.Width;
		samplesBox.Height = rect.Height;
		samplesBox.Visible = true;
		samplesBox.Items.Add("无");
		for (int i = 0; i < experiment.Samples.Count; i++)
		{
			if (i != rowIndex)
			{
				samplesBox.Items.Add(experiment.Samples[i].label);
				if (experiment.Samples[i].guid == experiment.Samples[rowIndex].blank)
				{
					samplesBox.SelectedIndex = samplesBox.Items.Count - 1;
				}
			}
		}
		samplesBox.SelectedIndexChanged += delegate
		{
			int num3 = samplesBox.SelectedIndex - 1;
			if (num3 >= rowIndex)
			{
				num3++;
			}
			experiment.Samples[rowIndex].blank = ((samplesBox.SelectedIndex == 0) ? (-1) : experiment.Samples[num3].guid);
		};
	}

	private void dgvSamples_VerCopyed(object sender, EventArgs e)
	{
		if (sender is DataGridViewCell cell)
		{
			if (cell.ColumnIndex == colSampleType.Index)
			{
				SamplesChangedNotify();
			}
			else if (cell.ColumnIndex == colSampleLabel.Index)
			{
				((Control)(object)dgvSamples).Refresh();
			}
		}
	}

	private void dgvSamples_CurrentCellDirtyStateChanged(object sender, EventArgs e)
	{
		if (((DataGridView)(object)dgvSamples).IsCurrentCellDirty)
		{
			((DataGridView)(object)dgvSamples).CommitEdit(DataGridViewDataErrorContexts.Commit);
		}
	}

	private void FormSamples_Load(object sender, EventArgs e)
	{
		base.WindowState = FormWindowState.Maximized;
		dtSampleType.Columns.Add("SampleType", typeof(string));
		dtSampleType.Columns.Add("SampleValue", typeof(int));
		dtSampleType.Rows.Add(Lang.Txt("FormExperiment.ConstNouns.SampleBlk.Text"), 0);
		dtSampleType.Rows.Add(Lang.Txt("FormExperiment.ConstNouns.SampleFQ.Text"), 1);
		dtSampleType.Rows.Add(Lang.Txt("FormExperiment.ConstNouns.SampleAddSA.Text"), 2);
		dtSampleType.Rows.Add(Lang.Txt("FormExperiment.ConstNouns.SampleUnk.Text"), 3);
		colSampleType.DataSource = dtSampleType;
		colSampleType.DisplayMember = "SampleType";
		colSampleType.ValueMember = "SampleValue";
		InitSamples();
		dgvSamples.VerCopyed += dgvSamples_VerCopyed;
		dgvSamples.SetDoubleBuffer();
		ApplyResources();
	}

	private void ApplyResources()
	{
		Text = Lang.Txt("FormSample.Title.Text");
		tsbtnDelete.Text = Lang.Txt("FormSample.Delete.Text");
		colSampleBlank.HeaderText = Lang.Txt("FormSample.Columns.Blank.Text");
		colSampleDilution.HeaderText = Lang.Txt("FormSample.Columns.Dilution.Text");
		colSampleInternal.HeaderText = Lang.Txt("FormSample.Columns.STDCurve.GroupIndex.Text");
		colSampleLabel.HeaderText = Lang.Txt("FormSample.Columns.Label.Text");
		colSampleNumber.HeaderText = Lang.Txt("FormSample.Columns.Seq.Text");
		colSampleReport.HeaderText = Lang.Txt("FormSample.Columns.Select.Text");
		colSampleScan.HeaderText = Lang.Txt("FormSample.Columns.SweepNo.Text");
		colSampleType.HeaderText = Lang.Txt("FormSample.Columns.SampleType.Text");
	}

	private void SamplesChangedNotify()
	{
		experiment.SetupSampleAcqTimes();
		experiment.SetupISTDbySamples();
		experiment.Dirty.SamplesDirty = true;
		experiment.OnSampleChanged();
	}

	private void SampleNameChangedNotify()
	{
		experiment.Dirty.SamplesDirty = true;
		experiment.OnSampleChanged();
	}

	public void RefreshResults()
	{
		Invoke((MethodInvoker)delegate
		{
			((Control)(object)dgvSamples).Refresh();
		});
	}

	private void dgvSamples_CellValueChanged(object sender, DataGridViewCellEventArgs e)
	{
		if (e.ColumnIndex == colSampleLabel.Index && e.RowIndex >= 0)
		{
			string label = "";
			object o = ((DataGridView)(object)dgvSamples)[e.ColumnIndex, e.RowIndex].Value;
			if (o != null)
			{
				label = o.ToString();
			}
			SamplesInfos sample = experiment.Samples[e.RowIndex];
			experiment.ChangeSampleLabel(sample);
			SampleNameChangedNotify();
		}
		else if (e.ColumnIndex == colSampleType.Index && e.RowIndex >= 0)
		{
			SamplesChangedNotify();
		}
		else if (e.ColumnIndex == colSampleScan.Index && e.RowIndex >= 0)
		{
			experiment.UpdateResultsBySampleId(experiment.Samples[e.RowIndex]);
			SampleNameChangedNotify();
			experiment.Dirty.SamplesDirty = true;
		}
	}

	public void SetSurveyScanVisible()
	{
		RebindSamples();
	}

	private void dgvSamples_KeyDown(object sender, KeyEventArgs e)
	{
		if (((DataGridView)(object)dgvSamples).SelectedRows != null && ((DataGridView)(object)dgvSamples).SelectedRows.Count > 0 && e.KeyCode == Keys.Delete)
		{
			DeleteSamples();
		}
	}

	private void DeleteSamples()
	{
		List<SamplesInfos> samples = new List<SamplesInfos>();
		foreach (DataGridViewRow row in ((DataGridView)(object)dgvSamples).SelectedRows)
		{
			samples.Add(experiment.Samples[row.Index]);
		}
		foreach (SamplesInfos sample in samples)
		{
			if (sample.status != -1)
			{
				experiment.Samples.Remove(sample);
			}
		}
		RebindSamples();
		SamplesChangedNotify();
		experiment.Dirty.SamplesDirty = true;
		experiment.Dirty.ResultsDirty = true;
		experiment.Dirty.SpectrumDirty = true;
	}

	private void MoveSamples(bool upDown)
	{
		if (((DataGridView)(object)dgvSamples).SelectedRows.Count <= 0)
		{
			return;
		}
		List<SamplesInfos> samples = new List<SamplesInfos>();
		List<int> indexs = new List<int>();
		foreach (DataGridViewRow row in ((DataGridView)(object)dgvSamples).SelectedRows)
		{
			indexs.Add(row.Index);
			samples.Add(experiment.Samples[row.Index]);
		}
		for (int i = 0; i < samples.Count; i++)
		{
			int index = experiment.Samples.IndexOf(samples[i]);
			if (upDown && indexs[i] > 0)
			{
				experiment.Samples[index] = experiment.Samples[indexs[i] - 1];
				experiment.Samples[indexs[i] - 1] = samples[i];
			}
			else if (indexs[i] < experiment.Samples.Count - 1)
			{
				experiment.Samples[index] = experiment.Samples[indexs[i] + 1];
				experiment.Samples[indexs[i] + 1] = samples[i];
			}
		}
		RebindSamples();
	}

	private void dgvSamples_MouseDown(object sender, MouseEventArgs e)
	{
		if (e.Button == MouseButtons.Right && ((DataGridView)(object)dgvSamples).SelectedRows.Count > 0)
		{
			Cursor = new Cursor(new MemoryStream(Resources.Drag));
			dragData = true;
			dragDest = -1;
		}
	}

	private void dgvSamples_MouseUp(object sender, MouseEventArgs e)
	{
		if (dragData)
		{
			dragData = false;
			Cursor = Cursors.Arrow;
			DoDrag();
			RebindSamples();
		}
	}

	private void dgvSamples_MouseMove(object sender, MouseEventArgs e)
	{
		if (!dragData)
		{
			return;
		}
		int x = e.X;
		int y = e.Y;
		((Control)(object)dgvSamples).Refresh();
		Graphics g = ((Control)(object)dgvSamples).CreateGraphics();
		Rectangle clientR = base.ClientRectangle;
		Rectangle firstR = ((DataGridView)(object)dgvSamples).GetRowDisplayRectangle(0, cutOverflow: false);
		Rectangle lastR = ((DataGridView)(object)dgvSamples).GetRowDisplayRectangle(((DataGridView)(object)dgvSamples).Rows.Count - 1, cutOverflow: false);
		int destY = 0;
		dragDest = -1;
		if (y <= clientR.Y || (firstR.Y > 0 && y <= firstR.Y))
		{
			destY = Math.Max(clientR.Y, firstR.Y);
			dragDest = 0;
		}
		else if (y >= clientR.Bottom || (lastR.Bottom > 0 && y >= lastR.Bottom))
		{
			dragDest = ((DataGridView)(object)dgvSamples).RowCount;
			destY = ((lastR.Bottom == 0) ? clientR.Bottom : Math.Min(clientR.Bottom, lastR.Bottom));
		}
		else
		{
			DataGridView.HitTestInfo hit = ((DataGridView)(object)dgvSamples).HitTest(x, y);
			if (hit.RowIndex != -1)
			{
				dragDest = hit.RowIndex;
				destY = ((DataGridView)(object)dgvSamples).GetRowDisplayRectangle(hit.RowIndex, cutOverflow: false).Y;
			}
		}
		g.DrawLine(new Pen(Color.Red, 2f), clientR.X, destY, clientR.Right, destY);
		g.Dispose();
	}

	private void DoDrag()
	{
		if (dragDest == -1)
		{
			return;
		}
		List<SamplesInfos> samples = new List<SamplesInfos>(experiment.Samples);
		List<SamplesInfos> selects = new List<SamplesInfos>();
		foreach (DataGridViewRow row in ((DataGridView)(object)dgvSamples).SelectedRows)
		{
			SamplesInfos sample = experiment.Samples[row.Index];
			samples.Remove(sample);
			selects.Add(sample);
		}
		selects.Sort((SamplesInfos s1, SamplesInfos s2) => s1.number.CompareTo(s2.number));
		if (dragDest == experiment.Samples.Count)
		{
			samples.InsertRange(dragDest - selects.Count, selects);
		}
		else
		{
			SamplesInfos destSample = experiment.Samples[dragDest];
			if (selects.Contains(destSample))
			{
				return;
			}
			dragDest = samples.IndexOf(destSample);
			samples.InsertRange(dragDest, selects);
		}
		experiment.Samples = samples;
		experiment.Dirty.SamplesDirty = true;
	}

	private void tsbtnDelete_Click(object sender, EventArgs e)
	{
		DeleteSamples();
	}

	private void dgvSamples_RowHeaderMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e)
	{
		if (e.RowIndex >= 0)
		{
			experiment.CheckReferSample(e.RowIndex);
			((Control)(object)dgvSamples).Refresh();
		}
	}

	private void dgvSamples_RowPostPaint(object sender, DataGridViewRowPostPaintEventArgs e)
	{
		if (e.RowIndex >= 0)
		{
			if (experiment.Samples[e.RowIndex].refer)
			{
				Rectangle rect = ((DataGridView)(object)dgvSamples).GetRowDisplayRectangle(e.RowIndex, cutOverflow: true);
				e.Graphics.DrawImage(Resources.refer16, new Point(4, rect.Y + 4));
				((DataGridView)(object)dgvSamples).Rows[e.RowIndex].HeaderCell.ToolTipText = "内标参照基础";
			}
			else
			{
				((DataGridView)(object)dgvSamples).Rows[e.RowIndex].HeaderCell.ToolTipText = "双击设定内标参照";
			}
		}
	}

	public void SelectedChanged(object sender, EventArgs e)
	{
		ToolStripButton btn = sender as ToolStripButton;
		if (!btn.Checked)
		{
			DisposeBoxes();
		}
	}

	protected override void Dispose(bool disposing)
	{
		if (disposing && components != null)
		{
			components.Dispose();
		}
		base.Dispose(disposing);
	}

	private void InitializeComponent()
	{
		//IL_0043: Unknown result type (might be due to invalid IL or missing references)
		//IL_004d: Expected O, but got Unknown
		System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
		System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle();
		System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle();
		System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle();
		System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle5 = new System.Windows.Forms.DataGridViewCellStyle();
		this.toolStrip1 = new System.Windows.Forms.ToolStrip();
		this.toolStripSeparator3 = new System.Windows.Forms.ToolStripSeparator();
		this.tsbtnDelete = new System.Windows.Forms.ToolStripButton();
		this.dgvSamples = new DbufferGrid();
		this.colSampleNumber = new System.Windows.Forms.DataGridViewTextBoxColumn();
		this.colSampleReport = new System.Windows.Forms.DataGridViewCheckBoxColumn();
		this.colSampleLabel = new System.Windows.Forms.DataGridViewTextBoxColumn();
		this.colSampleType = new System.Windows.Forms.DataGridViewComboBoxColumn();
		this.colSampleScan = new System.Windows.Forms.DataGridViewTextBoxColumn();
		this.colSampleDilution = new System.Windows.Forms.DataGridViewTextBoxColumn();
		this.colSampleInternal = new System.Windows.Forms.DataGridViewTextBoxColumn();
		this.colSampleBlank = new System.Windows.Forms.DataGridViewTextBoxColumn();
		this.dataGridViewTextBoxColumn1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
		this.dataGridViewTextBoxColumn2 = new System.Windows.Forms.DataGridViewTextBoxColumn();
		this.dataGridViewTextBoxColumn3 = new System.Windows.Forms.DataGridViewTextBoxColumn();
		this.dataGridViewTextBoxColumn4 = new System.Windows.Forms.DataGridViewTextBoxColumn();
		this.dataGridViewTextBoxColumn5 = new System.Windows.Forms.DataGridViewTextBoxColumn();
		this.dataGridViewTextBoxColumn6 = new System.Windows.Forms.DataGridViewTextBoxColumn();
		this.dataGridViewTextBoxColumn7 = new System.Windows.Forms.DataGridViewTextBoxColumn();
		this.dataGridViewTextBoxColumn8 = new System.Windows.Forms.DataGridViewTextBoxColumn();
		System.Windows.Forms.ToolStripButton tsbtnAddSamples = new System.Windows.Forms.ToolStripButton();
		this.toolStrip1.SuspendLayout();
		((System.ComponentModel.ISupportInitialize)this.dgvSamples).BeginInit();
		base.SuspendLayout();
		tsbtnAddSamples.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
		tsbtnAddSamples.Image = ICP_MS.Plugin.LA300.Properties.Resources.Add;
		tsbtnAddSamples.ImageTransparentColor = System.Drawing.Color.Magenta;
		tsbtnAddSamples.Name = "tsbtnAddSamples";
		tsbtnAddSamples.Size = new System.Drawing.Size(23, 20);
		tsbtnAddSamples.Text = "添加一组样品";
		tsbtnAddSamples.ToolTipText = "添加一组样品";
		tsbtnAddSamples.Click += new System.EventHandler(tsbtnAddSamples_Click);
		this.toolStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[3] { tsbtnAddSamples, this.toolStripSeparator3, this.tsbtnDelete });
		this.toolStrip1.LayoutStyle = System.Windows.Forms.ToolStripLayoutStyle.Flow;
		this.toolStrip1.Location = new System.Drawing.Point(0, 0);
		this.toolStrip1.Name = "toolStrip1";
		this.toolStrip1.RenderMode = System.Windows.Forms.ToolStripRenderMode.System;
		this.toolStrip1.Size = new System.Drawing.Size(836, 23);
		this.toolStrip1.TabIndex = 3;
		this.toolStrip1.Text = "Add samples";
		this.toolStripSeparator3.Name = "toolStripSeparator3";
		this.toolStripSeparator3.Size = new System.Drawing.Size(6, 23);
		this.tsbtnDelete.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
		this.tsbtnDelete.Image = ICP_MS.Plugin.LA300.Properties.Resources.Remove;
		this.tsbtnDelete.ImageTransparentColor = System.Drawing.Color.Magenta;
		this.tsbtnDelete.Name = "tsbtnDelete";
		this.tsbtnDelete.Size = new System.Drawing.Size(23, 20);
		this.tsbtnDelete.Text = "删除选中的样品";
		this.tsbtnDelete.Click += new System.EventHandler(tsbtnDelete_Click);
		((System.Windows.Forms.DataGridView)(object)this.dgvSamples).AllowUserToResizeColumns = false;
		((System.Windows.Forms.DataGridView)(object)this.dgvSamples).AllowUserToResizeRows = false;
		dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
		((System.Windows.Forms.DataGridView)(object)this.dgvSamples).AlternatingRowsDefaultCellStyle = dataGridViewCellStyle1;
		((System.Windows.Forms.DataGridView)(object)this.dgvSamples).AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.DisplayedCells;
		((System.Windows.Forms.DataGridView)(object)this.dgvSamples).BackgroundColor = System.Drawing.SystemColors.Control;
		dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
		dataGridViewCellStyle2.BackColor = System.Drawing.SystemColors.Control;
		dataGridViewCellStyle2.Font = new System.Drawing.Font("宋体", 9f, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 134);
		dataGridViewCellStyle2.ForeColor = System.Drawing.SystemColors.WindowText;
		dataGridViewCellStyle2.SelectionBackColor = System.Drawing.SystemColors.Highlight;
		dataGridViewCellStyle2.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
		dataGridViewCellStyle2.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
		((System.Windows.Forms.DataGridView)(object)this.dgvSamples).ColumnHeadersDefaultCellStyle = dataGridViewCellStyle2;
		((System.Windows.Forms.DataGridView)(object)this.dgvSamples).ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
		((System.Windows.Forms.DataGridView)(object)this.dgvSamples).Columns.AddRange(this.colSampleNumber, this.colSampleReport, this.colSampleLabel, this.colSampleType, this.colSampleScan, this.colSampleDilution, this.colSampleInternal, this.colSampleBlank);
		dataGridViewCellStyle3.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
		dataGridViewCellStyle3.BackColor = System.Drawing.SystemColors.Window;
		dataGridViewCellStyle3.Font = new System.Drawing.Font("宋体", 9f, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 134);
		dataGridViewCellStyle3.ForeColor = System.Drawing.SystemColors.ControlText;
		dataGridViewCellStyle3.SelectionBackColor = System.Drawing.SystemColors.Highlight;
		dataGridViewCellStyle3.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
		dataGridViewCellStyle3.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
		((System.Windows.Forms.DataGridView)(object)this.dgvSamples).DefaultCellStyle = dataGridViewCellStyle3;
		((System.Windows.Forms.Control)(object)this.dgvSamples).Dock = System.Windows.Forms.DockStyle.Fill;
		this.dgvSamples.HorCopy = false;
		((System.Windows.Forms.Control)(object)this.dgvSamples).Location = new System.Drawing.Point(0, 23);
		((System.Windows.Forms.Control)(object)this.dgvSamples).Name = "dgvSamples";
		dataGridViewCellStyle4.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
		dataGridViewCellStyle4.BackColor = System.Drawing.SystemColors.Control;
		dataGridViewCellStyle4.Font = new System.Drawing.Font("宋体", 9f, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 134);
		dataGridViewCellStyle4.ForeColor = System.Drawing.SystemColors.WindowText;
		dataGridViewCellStyle4.SelectionBackColor = System.Drawing.SystemColors.Highlight;
		dataGridViewCellStyle4.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
		dataGridViewCellStyle4.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
		((System.Windows.Forms.DataGridView)(object)this.dgvSamples).RowHeadersDefaultCellStyle = dataGridViewCellStyle4;
		((System.Windows.Forms.DataGridView)(object)this.dgvSamples).RowHeadersWidthSizeMode = System.Windows.Forms.DataGridViewRowHeadersWidthSizeMode.AutoSizeToAllHeaders;
		dataGridViewCellStyle5.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
		((System.Windows.Forms.DataGridView)(object)this.dgvSamples).RowsDefaultCellStyle = dataGridViewCellStyle5;
		((System.Windows.Forms.DataGridView)(object)this.dgvSamples).RowTemplate.Height = 23;
		((System.Windows.Forms.Control)(object)this.dgvSamples).Size = new System.Drawing.Size(836, 460);
		((System.Windows.Forms.Control)(object)this.dgvSamples).TabIndex = 4;
		this.dgvSamples.VerCopy = true;
		((System.Windows.Forms.DataGridView)(object)this.dgvSamples).CellFormatting += new System.Windows.Forms.DataGridViewCellFormattingEventHandler(dgvSamples_CellFormatting);
		((System.Windows.Forms.DataGridView)(object)this.dgvSamples).CellLeave += new System.Windows.Forms.DataGridViewCellEventHandler(dgvSamples_CellLeave);
		((System.Windows.Forms.DataGridView)(object)this.dgvSamples).CellValueChanged += new System.Windows.Forms.DataGridViewCellEventHandler(dgvSamples_CellValueChanged);
		((System.Windows.Forms.DataGridView)(object)this.dgvSamples).CurrentCellChanged += new System.EventHandler(dgvSamples_CurrentCellChanged);
		((System.Windows.Forms.DataGridView)(object)this.dgvSamples).CurrentCellDirtyStateChanged += new System.EventHandler(dgvSamples_CurrentCellDirtyStateChanged);
		((System.Windows.Forms.DataGridView)(object)this.dgvSamples).RowHeaderMouseDoubleClick += new System.Windows.Forms.DataGridViewCellMouseEventHandler(dgvSamples_RowHeaderMouseDoubleClick);
		((System.Windows.Forms.DataGridView)(object)this.dgvSamples).RowPostPaint += new System.Windows.Forms.DataGridViewRowPostPaintEventHandler(dgvSamples_RowPostPaint);
		((System.Windows.Forms.Control)(object)this.dgvSamples).KeyDown += new System.Windows.Forms.KeyEventHandler(dgvSamples_KeyDown);
		((System.Windows.Forms.Control)(object)this.dgvSamples).MouseDown += new System.Windows.Forms.MouseEventHandler(dgvSamples_MouseDown);
		((System.Windows.Forms.Control)(object)this.dgvSamples).MouseMove += new System.Windows.Forms.MouseEventHandler(dgvSamples_MouseMove);
		((System.Windows.Forms.Control)(object)this.dgvSamples).MouseUp += new System.Windows.Forms.MouseEventHandler(dgvSamples_MouseUp);
		this.colSampleNumber.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
		this.colSampleNumber.DataPropertyName = "number";
		this.colSampleNumber.HeaderText = "序号";
		this.colSampleNumber.Name = "colSampleNumber";
		this.colSampleNumber.ReadOnly = true;
		this.colSampleReport.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
		this.colSampleReport.DataPropertyName = "report";
		this.colSampleReport.HeaderText = "选择";
		this.colSampleReport.Name = "colSampleReport";
		this.colSampleLabel.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
		this.colSampleLabel.DataPropertyName = "label";
		this.colSampleLabel.HeaderText = "标签";
		this.colSampleLabel.Name = "colSampleLabel";
		this.colSampleLabel.Resizable = System.Windows.Forms.DataGridViewTriState.True;
		this.colSampleLabel.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
		this.colSampleType.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
		this.colSampleType.DataPropertyName = "type";
		this.colSampleType.DisplayStyle = System.Windows.Forms.DataGridViewComboBoxDisplayStyle.Nothing;
		this.colSampleType.HeaderText = "样品类型";
		this.colSampleType.Name = "colSampleType";
		this.colSampleType.Resizable = System.Windows.Forms.DataGridViewTriState.True;
		this.colSampleType.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
		this.colSampleScan.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
		this.colSampleScan.DataPropertyName = "mains";
		this.colSampleScan.HeaderText = "测试次数";
		this.colSampleScan.Name = "colSampleScan";
		this.colSampleDilution.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
		this.colSampleDilution.DataPropertyName = "predilution";
		this.colSampleDilution.HeaderText = "稀释";
		this.colSampleDilution.Name = "colSampleDilution";
		this.colSampleInternal.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
		this.colSampleInternal.DataPropertyName = "inter";
		this.colSampleInternal.HeaderText = "内标方案";
		this.colSampleInternal.Name = "colSampleInternal";
		this.colSampleBlank.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
		this.colSampleBlank.DataPropertyName = "blank";
		this.colSampleBlank.HeaderText = "指定空白";
		this.colSampleBlank.Name = "colSampleBlank";
		this.dataGridViewTextBoxColumn1.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
		this.dataGridViewTextBoxColumn1.DataPropertyName = "number";
		this.dataGridViewTextBoxColumn1.HeaderText = "序号";
		this.dataGridViewTextBoxColumn1.Name = "dataGridViewTextBoxColumn1";
		this.dataGridViewTextBoxColumn1.ReadOnly = true;
		this.dataGridViewTextBoxColumn2.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
		this.dataGridViewTextBoxColumn2.DataPropertyName = "label";
		this.dataGridViewTextBoxColumn2.HeaderText = "标签";
		this.dataGridViewTextBoxColumn2.Name = "dataGridViewTextBoxColumn2";
		this.dataGridViewTextBoxColumn2.Resizable = System.Windows.Forms.DataGridViewTriState.True;
		this.dataGridViewTextBoxColumn2.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
		this.dataGridViewTextBoxColumn3.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
		this.dataGridViewTextBoxColumn3.DataPropertyName = "type";
		this.dataGridViewTextBoxColumn3.HeaderText = "样品类型";
		this.dataGridViewTextBoxColumn3.Name = "dataGridViewTextBoxColumn3";
		this.dataGridViewTextBoxColumn4.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
		this.dataGridViewTextBoxColumn4.DataPropertyName = "surveys";
		this.dataGridViewTextBoxColumn4.HeaderText = "全扫次数";
		this.dataGridViewTextBoxColumn4.Name = "dataGridViewTextBoxColumn4";
		this.dataGridViewTextBoxColumn5.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
		this.dataGridViewTextBoxColumn5.DataPropertyName = "mains";
		this.dataGridViewTextBoxColumn5.HeaderText = "测试次数";
		this.dataGridViewTextBoxColumn5.Name = "dataGridViewTextBoxColumn5";
		this.dataGridViewTextBoxColumn6.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
		this.dataGridViewTextBoxColumn6.DataPropertyName = "predilution";
		this.dataGridViewTextBoxColumn6.HeaderText = "稀释";
		this.dataGridViewTextBoxColumn6.Name = "dataGridViewTextBoxColumn6";
		this.dataGridViewTextBoxColumn7.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
		this.dataGridViewTextBoxColumn7.DataPropertyName = "inter";
		this.dataGridViewTextBoxColumn7.HeaderText = "内标方案";
		this.dataGridViewTextBoxColumn7.Name = "dataGridViewTextBoxColumn7";
		this.dataGridViewTextBoxColumn8.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
		this.dataGridViewTextBoxColumn8.DataPropertyName = "blank";
		this.dataGridViewTextBoxColumn8.HeaderText = "指定空白";
		this.dataGridViewTextBoxColumn8.Name = "dataGridViewTextBoxColumn8";
		base.AutoScaleDimensions = new System.Drawing.SizeF(6f, 12f);
		base.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
		base.ClientSize = new System.Drawing.Size(836, 483);
		base.Controls.Add((System.Windows.Forms.Control)(object)this.dgvSamples);
		base.Controls.Add(this.toolStrip1);
		base.Name = "FormSamples";
		base.ShowIcon = false;
		this.Text = "FormSamples";
		base.Load += new System.EventHandler(FormSamples_Load);
		this.toolStrip1.ResumeLayout(false);
		this.toolStrip1.PerformLayout();
		((System.ComponentModel.ISupportInitialize)this.dgvSamples).EndInit();
		base.ResumeLayout(false);
		base.PerformLayout();
	}
}
